package demo4;

// 利用lambda 表达式来实现 Thread
public class Test5 {
    public static void main(String[] args) {
        Thread t=new Thread(()->{
            while(true) {
                System.out.println("this is lambdaThread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        t.start();

        while(true) {
            System.out.println("this is mainThread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
